﻿using Student.主界面;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Student.登录
{
    public partial class 学生端登录 : Form
    {
        public 学生端登录()
        {
            InitializeComponent();
        }
        // 登录完成
        private void button1_Click(object sender, EventArgs e)//登录功能
        {
            try
            {
                Models.Student student = new Models.Student();
                student.stu_no = textBox1.Text;
                student.pwd = textBox2.Text;
                BLL.B_Student b_Student = new BLL.B_Student();
                bool res = b_Student.Login(student);
                if (res)
                {
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    throw new Exception("用户名或密码错误");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
    }
}
